<!--
  ~ Copyright 2004-2012 ICEsoft Technologies Canada Corp.
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the
  ~ License. You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an "AS
  ~ IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
  ~ express or implied. See the License for the specific language
  ~ governing permissions and limitations under the License.
  -->
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:ice="http://www.icesoft.com/icefaces/component"
                xmlns:ace="http://www.icefaces.org/icefaces/components"
                xmlns:ui="http://java.sun.com/jsf/facelets">
<!--
Available ui:params to pass:
 title
 description
 resourceValue
-->
    <div class="example">
        <ace:panel header="#{title}" id="examplePanel" styleClass="containerPanelStyle">
        <div class="content">
            <div class="desc">
                <ice:outputText value="#{description}" escape="false" nospan="true"/>
            </div>
            <h:panelGroup layout="block" styleClass="instance" rendered="#{navigationModel.renderAsExample}">
                <ui:insert name="example"/>
            </h:panelGroup>
        </div>
            <f:facet name="options">  
                <ace:menu >
                    <ace:submenu label="WIKI Documentation">
                        <c:forEach items="#{wikiResources}" var="wiki">
                           <ace:menuItem value="#{wiki.title}" url="#{wiki.resource}" target="_blank"/>
                        </c:forEach>
                    </ace:submenu>
                    <ace:submenu label="TLD Documentation">
                        <c:forEach items="#{tldResources}" var="tld">
                           <ace:menuItem value="#{tld.title}" url="#{tld.resource}" target="_blank"/>
                        </c:forEach>
                    </ace:submenu>
                </ace:menu>  
            </f:facet>  
        </ace:panel>
        
        <h:form id="sourceCodeForm" rendered="#{navigationModel.renderAsExample}">
            <ace:panel id="sourceCodePanel" collapsed="#{navigationModel.sourceCodeToggleStatus}" toggleable="true" header="Source Code" styleClass="containerPanelStyle">
                <div class="resources">
                    <ace:ajax event="toggle" execute="@this"/>
                    <ace:tabSet clientSide="true" selectedIndex="0"
                                rendered="#{not empty resourceValue}">
                        <c:forEach items="#{resourceValue}"
                                   var="exRes">
                            <ace:tabPane label="#{exRes.title}">
                                <h:outputText escape="false" value="#{sourceCodeLoaderConnection[exRes.resource]}" />
                            </ace:tabPane>
                        </c:forEach>
                    </ace:tabSet>
                </div>
            </ace:panel>
        </h:form>
    </div>
</ui:composition>
